<template>
    <div class="person-center">
        <h1>XINHUANXIANG</h1>
        <ul class="nav van-hairline--top">
            <li class="van-hairline--bottom" @click="$router.push('/person/balance')">
                <div class="flex1">
                    <img :src="require('../../../assets/images/m1.png')" />
                    <span>我的余额</span>
                </div>
                <span class="iconfont icon-you"></span>
            </li>
            <li class="van-hairline--bottom" @click="$router.push('/course')">
                <div class="flex1">
                    <img :src="require('../../../assets/images/m2.png')" />
                    <span>我的课程</span>
                </div>
                <span class="iconfont icon-you"></span>
            </li>
            <li class="van-hairline--bottom" @click="$router.push('/person/browsingHistory')">
                <div class="flex1">
                    <img :src="require('../../../assets/images/m3.png')" />
                    <span>我的浏览记录</span>
                </div>
                <span class="iconfont icon-you"></span>
            </li>
            <li @click="$router.push('/person/changepwd')">
                <div class="flex1">
                    <img :src="require('../../../assets/images/m4.png')" />
                    <span>修改手机号码</span>
                </div>
                <span class="iconfont icon-you"></span>
            </li>
        </ul>
        <button class="logout" @click="$router.push('/login')">退出</button>
    </div>
</template>
<script>
import { getCookie } from '@/utils/cookie.js'
export default {
    mounted () {
        let userinfo = getCookie('userinfo') || {}
        if (!userinfo.username) {
            setTimeout(()=>{
                this.$router.replace({ path: '/login', query: { redirect: '/person/center' } })
            },600)
        }
    }
}
</script>
<style lang="less" scoped>
.person-center {
    padding: 0 70 / 2px;
    .logout {
        width: 100%;
        display: block;
        border-radius: 80/2px;
        height: 100/2px;
        text-align: center;
        margin-top: 200/2px;
        background: @bgcolor;
        border: none;
    }
    h1 {
        text-align: center;
        font-weight: normal;
        font-family: serif;
        color: #fff;
        margin: 10 / 2px 0 40 / 2px;
    }
    .nav {
        padding: 0 10 / 2px;
        &::after {
            border-color: @bgcolor;
        }
        li {
            height: 100 / 2px;
            display: flex;
            align-items: center;
            .flex1 {
                flex: 1;
                display: flex;
                align-items: center;
                img {
                    width: 40/2px;
                    margin-right: 20/2px;
                }
            }
            &::after {
                border-color: @bgcolor;
            }
            .iconfont {
                font-size: 20 / 2px;
                color: #ffffff80;
            }
        }
    }
}
</style>